import multiprocessing
import time

"""
进程消耗资源比线程大的多
创建新进程要从硬盘重新加载代码开辟内存空间等复杂操作消耗性能
"""


def test1():
    while True:
        print("-------1-------")
        time.sleep(1)


def test2():
    while True:
        print("-------2-------")
        time.sleep(1)


def main():
    p1 = multiprocessing.Process(target=test1)
    p2 = multiprocessing.Process(target=test2)

    p1.start()
    p2.start()


if __name__ == '__main__':
    main()
